home *** CD-ROM | disk | FTP | other *** search
/ Champak 66 / Vol 66.iso / games / bob_espo.swf / scripts / __Packages / MinigameTransition.as < prev    next >
Text File  |  2013-04-24  |  2KB  |  68 lines

  1. class MinigameTransition extends State
  2. {
  3.    static var sSTATE_IDLE = "Idle";
  4.    static var sSTATE_PLAY_LEFT = "PlayLeft";
  5.    static var sSTATE_PLAY_RIGHT = "PlayRight";
  6.    static var nFRAME_CHANGE = 15;
  7.    function MinigameTransition(_mcRef)
  8.    {
  9.       super(_mcRef);
  10.       this.setState(MinigameTransition.sSTATE_IDLE);
  11.       this.bIsLeft = !!Math.round(Math.random());
  12.    }
  13.    function isInIdle()
  14.    {
  15.       var _loc2_ = false;
  16.       if(this.sState == MinigameTransition.sSTATE_IDLE)
  17.       {
  18.          _loc2_ = true;
  19.       }
  20.       return _loc2_;
  21.    }
  22.    function goTo(_sGoingTo)
  23.    {
  24.       this.sGoingTo = _sGoingTo;
  25.       if(this.sState == MinigameTransition.sSTATE_IDLE)
  26.       {
  27.          if(this.bIsLeft)
  28.          {
  29.             this.setState(MinigameTransition.sSTATE_PLAY_RIGHT);
  30.             this.bIsLeft = false;
  31.          }
  32.          else
  33.          {
  34.             this.setState(MinigameTransition.sSTATE_PLAY_LEFT);
  35.             this.bIsLeft = true;
  36.          }
  37.       }
  38.    }
  39.    function doPause()
  40.    {
  41.    }
  42.    function doUnPause()
  43.    {
  44.    }
  45.    function managePlayAnim()
  46.    {
  47.       if(this.stateFinished())
  48.       {
  49.          this.setState(MinigameTransition.sSTATE_IDLE);
  50.       }
  51.       else if(this.mcRef.mcState._currentframe == MinigameTransition.nFRAME_CHANGE)
  52.       {
  53.          CTRLGame.getRef().Screen.setState(this.sGoingTo);
  54.       }
  55.    }
  56.    function Idle()
  57.    {
  58.    }
  59.    function PlayLeft()
  60.    {
  61.       this.managePlayAnim();
  62.    }
  63.    function PlayRight()
  64.    {
  65.       this.managePlayAnim();
  66.    }
  67. }
  68.